Skip to content

feat: picker增加resistance属性,以支持通过鼠标滚轮进行选择时产生段落感 #6853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shusiwei
Copy link
Contributor

Copy link
Contributor

github-actions bot commented Mar 31, 2025

Preview is ready

Copy link

codecov bot commented Mar 31, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 92.67%. Comparing base (a0d2c3a) to head (3eab0c6).

Files with missing lines Patch % Lines
src/components/picker-view/wheel.tsx 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6853      +/-   ##
==========================================
- Coverage   92.68%   92.67%   -0.02%     
==========================================
  Files         335      335              
  Lines        7217     7219       +2     
  Branches     1779     1819      +40     
==========================================
+ Hits         6689     6690       +1     
- Misses        520      521       +1     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

const position = scrollY + distance * whellDir + speed
const position =
scrollY +
(distance / (props.wheelResistance ? 4 : 1)) * whellDir +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么 4 就认为是有段落感的?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么 4 就认为是有段落感的?

通过rubberbandIfOutOfBounds运算后,滚动差值会在itemHeight以内浮动,如果大于itemHeight,则无法一滚动一行,滚动差值过于小时,由于皮筋效应,会出现卡顿感,所以这个理想值被定在了4,也就是distance应该在25左右

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants